bitkeeper revision 1.1159.69.8 (413960891Us2H0wgOni9gC4Dvk3uCw)
authorkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>
Sat, 4 Sep 2004 06:28:25 +0000 (06:28 +0000)
committerkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>
Sat, 4 Sep 2004 06:28:25 +0000 (06:28 +0000)
Fix I/O mapping in Xen/Linux.

linux-2.6.8.1-xen-sparse/arch/xen/Kconfig
linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c
linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/io.h

index 9f4c1d800203899750d4d8213e5eea0cc513e68a..5beabc830dc38ce82630c54496c50396bf1e436f 100644 (file)
@@ -26,13 +26,12 @@ menu "XEN"
 config XEN_PRIVILEGED_GUEST
        bool "Privileged Guest (domain 0)"
        default n
+        select XEN_PHYSDEV_ACCESS
        help
          Support for privileged operation (domain 0)
 
 config XEN_PHYSDEV_ACCESS
        bool "Device-driver domain (physical device access)"
-       default y if XEN_PRIVILEGED_GUEST
-       default n
        help
          Device-driver domain (physical device access)
 
index eed63798217baed5e8a2fc4458f9f1b7f1fdd2e6..1efdacd8c228134203763f18c9a5d670fbeecb04 100644 (file)
 #include <asm/tlbflush.h>
 #include <asm/pgtable.h>
 
+#ifndef CONFIG_XEN_PHYSDEV_ACCESS
+
+void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
+{ return NULL; }
+
+void *ioremap_nocache (unsigned long phys_addr, unsigned long size)
+{ return NULL; }
+
+void iounmap(void *addr)
+{ }
+
+void __init *bt_ioremap(unsigned long phys_addr, unsigned long size)
+{ return NULL; }
+
+void __init bt_iounmap(void *addr, unsigned long size)
+{ }
+
+#else
+
 static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size,
        unsigned long phys_addr, unsigned long flags)
 {
@@ -133,11 +152,11 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag
        /*
         * Don't allow anybody to remap normal RAM that we're using..
         */
-       if (phys_addr < virt_to_phys(high_memory)) {
+       if (machine_to_phys(phys_addr) < virt_to_phys(high_memory)) {
                char *t_addr, *t_end;
                struct page *page;
 
-               t_addr = __va(phys_addr);
+               t_addr = bus_to_virt(phys_addr);
                t_end = t_addr + (size - 1);
           
                for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
@@ -200,8 +219,8 @@ void *ioremap_nocache (unsigned long phys_addr, unsigned long size)
        /* Guaranteed to be > phys_addr, as per __ioremap() */
        last_addr = phys_addr + size - 1;
 
-       if (last_addr < virt_to_phys(high_memory)) { 
-               struct page *ppage = virt_to_page(__va(phys_addr));             
+       if (machine_to_phys(last_addr) < virt_to_phys(high_memory)) { 
+               struct page *ppage = virt_to_page(bus_to_virt(phys_addr));
                unsigned long npages;
 
                phys_addr &= PAGE_MASK;
@@ -237,8 +256,8 @@ void iounmap(void *addr)
                return;
        } 
 
-       if (p->flags && p->phys_addr < virt_to_phys(high_memory)) { 
-               change_page_attr(virt_to_page(__va(p->phys_addr)),
+       if (p->flags && machine_to_phys(p->phys_addr) < virt_to_phys(high_memory)) { 
+               change_page_attr(virt_to_page(bus_to_virt(p->phys_addr)),
                                 p->size >> PAGE_SHIFT,
                                 PAGE_KERNEL);                           
                global_flush_tlb();
@@ -316,6 +335,7 @@ void __init bt_iounmap(void *addr, unsigned long size)
        }
 }
 
+#endif /* CONFIG_XEN_PHYSDEV_ACCESS */
 
 #if defined(CONFIG_XEN_PRIVILEGED_GUEST)
 
index 81de51c1b54b91b9f2570122959fa1e2b9df08c4..db076b437082a1263782b606a158a0a05170eeb1 100644 (file)
@@ -128,12 +128,12 @@ extern void bt_iounmap(void *addr, unsigned long size);
 /*
  * ISA I/O bus memory addresses are 1:1 with the physical address.
  */
-#define isa_virt_to_bus(_x) BUG() // should be (void *)((FIX_ISAMAP_BEGIN - __virt_to_fix((_x))) << PAGE_SHIFT)
-#define isa_page_to_bus(_x) BUG()  // page_to_phys(_x)
+#define isa_virt_to_bus(_x) isa_virt_to_bus_is_UNSUPPORTED->x
+#define isa_page_to_bus(_x) isa_page_to_bus_is_UNSUPPORTED->x
 #ifdef CONFIG_XEN_PRIVILEGED_GUEST
 #define isa_bus_to_virt(_x) (void *)__fix_to_virt(FIX_ISAMAP_BEGIN - ((_x) >> PAGE_SHIFT))
 #else
-#define isa_bus_to_virt(_x) (void *)0L /* XXXcl */
+#define isa_bus_to_virt(_x) isa_bus_to_virt_needs_PRIVILEGED_BUILD
 #endif
 
 /*